package com.ethan.blog.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户表;
 *
 * @author : Ethan
 * @date : 2024-5-24
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Tag(name = "用户表", description = "用户表，包含管理员")
@TableName(value = "user", autoResultMap = true)// 表名，自动映射
public class User implements Serializable, Cloneable {
    private static final long serialVersionUID = 1L; //
    /**
     * 用户id
     */
    @Schema(name = "用户id", description = "唯一，不可更改")
    @TableId(value = "id", type = IdType.AUTO) //表名主键，自增
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private Long id;
    /**
     * 昵称
     */
    @Schema(name = "昵称", description = "昵称不可为空，默认user+用户id")
    private String nickName;
    /**
     * 账号
     */
    @Schema(name = "账号", description = "账号唯一，不可为空，需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String account;
    /**
     * 邮箱
     */
    @Schema(name = "邮箱", description = "邮箱唯一，可以为空, 需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String email;
    /**
     * 手机号
     */
    @Schema(name = "手机号", description = "手机号唯一，可以为空, 需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String phoneNumber;
    /**
     * 密码
     */
    @Schema(name = "密码", description = "密码不得传输到前端，密码不可为空, 需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private String password;
    /**
     * 出生日期
     */
    @Schema(name = "出生日期", description = "出生日期可以为空")
    private Date datebirth;
    /**
     * 权限级别
     */
    @Schema(name = "权限级别", description = "不可为空，默认为0，数字越大权力越高, 需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private Integer permissionLevel;
    /**
     * 创建人
     */
    @Schema(name = "创建人", description = "默认为自己 0, 需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private Long createId;
    /**
     * 创建时间
     */
    @Schema(name = "创建时间", description = "当前时间, 需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private Date createTime;
    /**
     * 修改人
     */
    @Schema(name = "修改人", description = "默认为自己, 需要单独验证更新")
    private Long updateId;
    /**
     * 修改时间
     */
    @Schema(name = "修改时间", description = "当前时间")
    private Date updateTime;
    /**
     * 逻辑删除
     */
    @Schema(name = "逻辑删除", description = "1表示已删除（隐藏），0表示未删除，默认为0, 需要单独验证更新")
    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
    private Integer deleted;

}